<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ExpressionBuilder.ascx.cs" Inherits="Danser_AJAXEnabledWebApplication.User_Controls.ExpressionBuilder" %>

<style type="text/css">
        .style2
        {
            width: 15px;
        }
        .style3
        {
            width: 110px;
        }
        .style4
        {
            width: 50px;
        }
        .style5
        {
            width: 40px;
        }
        .style8
        {
            width: 70px;
        }
        .style10
        {
            width: 45px;
        }
        .style11
        {
            width: 60px;
        }
        .style12
        {
            width: 268px;
        }
        .StandardLabel
        {
	        font-weight: bold; 
	        font-size: 10pt; 
	        color: #191970 /*midnightblue*/; 
	        font-family: 'Arial'
        }
        .StandardLabelLight
        {
	        font-size: 10pt; 
	        color: #191970 /*midnightblue*/; 
	        font-family: 'Arial'
        }
        .StandardButton
        {
	        background-color: #191970 /*midnightblue*/; 
        	
	        border-top-color: #C0C0FF;
	        border-bottom-color: #C0C0FF;
	        border-right-color: #C0C0FF; 
	        border-left-color: #C0C0FF;
        	
	        border-top-style: solid;
	        border-bottom-style: solid;
	        border-right-style: solid; 
	        border-left-style: solid;

	        border-top-width: 1px;
	        border-bottom-width: 1px;
	        border-right-width: 1px; 
	        border-left-width: 1px;

	        font-family: 'Arial';
	        text-align: center;
            Width: 70px;
	        color: white;  
        }
        .style13
        {
            width: 58px;
        }
</style>
<script language="javascript" type="text/javascript" >
    
function confirmCancelWindow()
{ 
    var response = window.confirm("All data will be lost.\nAre you sure you want to clear?");
    if (response)
        return true;
    else
        return false;
}
</script>

  <asp:Panel ID="mainPanel" runat="server" BackColor="Lavender" Width="100%">
<div>
    <table>
        <tr>
            <td >
                <asp:Label ID="logicSelectionLabel" runat="server" Font-Bold="True" 
                    Font-Names="Arial" Font-Size="10pt" ForeColor="MidnightBlue" 
                    Text="Logic Operator:"></asp:Label>
            </td>
            <td width="62px">
                <asp:RadioButton ID="ANDSelector" runat="server" Font-Bold="True" 
                    Font-Names="Arial" Font-Size="10pt" ForeColor="MidnightBlue" Text="AND" 
                    AutoPostBack="True" oncheckedchanged="ANDSelector_CheckedChanged" Checked="True" />
            </td>
            <td width="62px">
                <asp:RadioButton ID="ORSelector" runat="server" Font-Bold="True" 
                    Font-Names="Arial" Font-Size="10pt" ForeColor="MidnightBlue" Text="OR" 
                    AutoPostBack="True" oncheckedchanged="ORSelector_CheckedChanged" />
            </td>
        </tr>
    </table>
    
    </div>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" GridLines="None" 
        onrowdatabound="GridView1_RowDataBound" Width="100%" ShowHeader="False">
        <Columns>
            <asp:TemplateField HeaderText="id">
                <ItemTemplate>
                    <asp:Label ID="IDLabel" runat="server" Text="id" Font-Names="Arial" 
                        Font-Size="10pt" ForeColor="MidnightBlue"></asp:Label>
                </ItemTemplate>
                <ItemStyle Width="15px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="BooleanOp">
                <ItemTemplate>
                    <table style="width:100%;">
                        <tr>
                            <td class="style13" style="width: 58px">
                                <asp:Label ID="booleanOperatorLabel" runat="server" Font-Bold="True" 
                                    Font-Names="Arial" Font-Size="10pt" ForeColor="MidnightBlue" 
                                    Text="AND">
                                </asp:Label>
                            </td>
                            <td>
                                <asp:CheckBox ID="notCheckBox" runat="server" Text="Not" 
                                    Font-Names="Arial" Font-Size="10pt" ForeColor="MidnightBlue" 
                                    CssClass="StandardLabelLight" />
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
                <ItemStyle Width="90px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Group">
                <ItemTemplate>
                    <table width="100%">
                        <tr>
                            <td align="right" class="style4">
                                <asp:Label ID="groupLabel" runat="server" 
                                    AssociatedControlID="groupDropDownList" CssClass="StandardLabelLight" Text="Group:"></asp:Label>
                            </td>
                            <td>
                                <asp:DropDownList ID="groupDropDownList" runat="server" AutoPostBack="True" 
                                    onselectedindexchanged="groupDropDownList_SelectedIndexChanged" Width="100%">
                                </asp:DropDownList>
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Left" Width="130px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Field">
                <ItemTemplate>
                    <table width="100%">
                        <tr>
                            <td align="right" class="style4">
                                <asp:Label ID="fieldLabel" runat="server" 
                                    AssociatedControlID="fieldDropDownList" CssClass="StandardLabelLight" Text="Field:"></asp:Label>
                            </td>
                            <td>
                                <asp:DropDownList ID="fieldDropDownList" runat="server" AutoPostBack="True" 
                                    onselectedindexchanged="fieldDropDownList_SelectedIndexChanged" Width="100%">
                                </asp:DropDownList>
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Left" Width="130px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Operator">
                <ItemTemplate>
                    <table width="100%">
                        <tr>
                            <td align="right" class="style8">
                                <asp:Label ID="operatorLabel" runat="server" 
                                    AssociatedControlID="operatorDropDownList" CssClass="StandardLabelLight" 
                                    Text="Operator:"></asp:Label>
                            </td>
                            <td>
                                <asp:DropDownList ID="operatorDropDownList" runat="server" Width="100%">
                                </asp:DropDownList>
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Left" Width="160px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Value">
                <ItemTemplate>
                    <table width="100%">
                        <tr>
                            <td align="right" class="style13">
                                <asp:Label ID="valueLabel" runat="server" AssociatedControlID="valueTextBox" 
                                    CssClass="StandardLabelLight" Text="Value:"></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="valueTextBox" runat="server" Width="100%"></asp:TextBox>
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Left" Width="140px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="command">
                <ItemTemplate>
                    <asp:LinkButton ID="deleteButton" runat="server" CssClass="StandardLabelLight" 
                        ForeColor="Red" onclick="deleteButton_Click">Remove</asp:LinkButton>
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Right" Width="80px" />
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <table style="width:100%;" width="100%">
        <tr align="left">
            <td class="style12" align="left">
                <table style="width:100%;">
                    <tr>
                        <td width="20">
                            <asp:Image ID="parserErrorImage" runat="server" ImageUrl="~/Resourses/Images/error.bmp" Visible="false"/>
                        </td>
                        <td align="left">
                        <asp:Label ID="parserErrorLabel" runat="server" CssClass="StandardLabel" 
                        ForeColor="Red" Text="Parser message here" Font-Bold="false" Visible="False"></asp:Label>
                        </td>
                    </tr>
                </table>
                <br />
                <asp:Button ID="addButton" runat="server" CssClass="StandardButton" 
                    onclick="addButton_Click" Text="New Row" />
                &nbsp;&nbsp;
                <asp:Button ID="clearButton" runat="server" CssClass="StandardButton" 
                    onclick="clearButton_Click" Text="Clear All" />
            </td>
        </tr>
        <tr>
            <td class="style12" style="height: 21px;">
                <asp:Panel ID="generationPanel" runat="server">
                    <table style="width:100%;">
                        <tr>
                            <td class="style1">
                                <asp:ObjectDataSource ID="objectDataSource" runat="server" 
                                    DeleteMethod="removeListElement" InsertMethod="addListElement" 
                                    OldValuesParameterFormatString="original_{0}" SelectMethod="getListElements" 
                                    TypeName="Danser_AJAXEnabledWebApplication.APP_Code.Expression_Builder.DummyDataSource">
                                    <DeleteParameters>
                                        <asp:Parameter Name="index" Type="Int32" />
                                    </DeleteParameters>
                                    <InsertParameters>
                                        <asp:Parameter Name="element" Type="Int32" />
                                    </InsertParameters>
                                </asp:ObjectDataSource>
                            </td>
                            <td>
                                &nbsp;</td>
                            <td>
                                &nbsp;</td>
                        </tr>
                        <tr>
                            <td class="style1">
                                <asp:Button ID="generateRuleButton" runat="server" CssClass="StandardButton" 
                                    OnClick="generateRuleButton_Click" Text="Generate" />
                            </td>
                            <td>
                                &nbsp;</td>
                            <td>
                                &nbsp;</td>
                        </tr>
                        <tr>
                            <td class="style1">
                                &nbsp;</td>
                            <td>
                                &nbsp;</td>
                            <td>
                                &nbsp;</td>
                        </tr>
                        <tr>
                            <td colspan="3">
                            <asp:Label ID="ruleLabel" runat="server" CssClass="StandardLabel" Text="Rule:"></asp:Label>
                                &nbsp;
                            <asp:TextBox ID="ruleTextBox" runat="server" BackColor="Gainsboro" 
                                    Enabled="True" ReadOnly="True" Width="90%"></asp:TextBox>
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </td>
        </tr>
    </table>
</asp:Panel>

